<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>维修计划页</title>
		<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
		<link rel="stylesheet" href="../lib/layui/css/layui.css">
		<link rel="stylesheet" href="../css/scroll-bar.css">
		<link rel="stylesheet" href="../css/sub-page.css">
		<link rel="stylesheet" href="//at.alicdn.com/t/font_693759_wytlyqhtdtj1nhfr.css">
		<link rel="stylesheet" href="../css/okadmin.css" />
	</head>

	<body>
		<div class="ok-body">
			<!--面包屑导航区域-->
			<div class="ok-body-breadcrumb">
				<span class="layui-breadcrumb">
                <a><cite>首页</cite></a>
                <a><cite>常用页面</cite></a>
                <a><cite>维修页</cite></a>
				<a><cite>维修计划</cite></a>
            </span>
				<a class="layui-btn layui-btn-small" href="javascript:location.replace(location.href);" title="刷新">
					<i class="layui-icon layui-icon-refresh"></i>
				</a>
			</div>
			<!--form表单-->
			<form class="layui-form ok-form">
				<h1 style="text-align: center;">详细维修计划</h1>
				<div class="layui-form-item">

					<label class="layui-form-label">客户信息</label>
					<div class="user-des">
						<table style="border: 1px solid firebrick;border-color: #C9C9C9;width: 80%;">
							<tr>
								<td>订单编号:</td>
								<td><input style="border:none;outline:medium;" readonly="readonly" class="orderId" /></td>
							</tr>
							<tr>
								<td>客户姓名:</td>
								<td><input style="border:none;outline:medium;" readonly="readonly" class="customerName" /></td>
							</tr>
							<tr>
								<td>车牌号码:</td>
								<td><input style="border:none;outline:medium;" readonly="readonly" class="carPlate" /></td>
							</tr>
							<tr>
								<td>客户电话:</td>
								<td><input style="border:none;outline:medium;" readonly="readonly" class="customerPhone" /></td>
							</tr>

						</table>
					</div>
				</div>

				<div class="layui-form-item layui-form-text">
					<label class="layui-form-label">维修详细</label>
					<div class="user-des">
						<table id="sa" style="border: 1px solid firebrick;border-color: #C9C9C9;width: 80%;">
							<tr class="tr">
								<td>损毁地方：</td>
								<td>更换部位:</td>
							</tr>
							<tr>
								<td><input type="text" name="dault_detail" value="座椅坏了" /></td>
								<td><input type="text" name="dault_detail" value="需要更换座椅" /></td>
							</tr>
							<tr>
								<td><input type="text" name="dault_detail" value="空调坏了" /></td>
								<td><input type="text" name="dault_detail" value="需要更换空调" /></td>
							</tr>
						</table>
					</div>
				</div>
				<div class="layui-form-item">
					<div class="layui-input-block">
						<button class="layui-btn" lay-submit lay-filter="edit">维修完成</button>
	<!--					<button type="reset" class="layui-btn layui-btn-primary">重置</button><br />-->
					</div>
				</div>
			</form>
		</div>
		<!--js逻辑-->
		<script src="../lib/layui/layui.js"></script>
		<script src="../js/jquery-3.3.1.min.js"></script>
		<!--<script>
			$.ajax({
				type: "POST",
				url: "some.php",
				data: "json",
				success: function(msg) {
					var a = msg.name;
					for(var i = 0; i < a.length; i++) {
						console.log(a[i]);
						$("#sa").append("<tr><td>" + a[i] + "</td><td><input type='text'value='" + a[i] + "' /></td></tr>")
					}
				}
			});
		</script>-->
		<script>
			layui.use(['element', 'form', 'jquery', 'laydate'], function() {
				var element = layui.element;
				var table = layui.table;
				var form = layui.form;
				var $ = layui.jquery;
				var laydate = layui.laydate;

				form.verify({
					birthdayVerify: [/^((((1[6-9]|[2-9]\d)\d{2})-(0?[13578]|1[02])-(0?[1-9]|[12]\d|3[01]))|(((1[6-9]|[2-9]\d)\d{2})-(0?[13456789]|1[012])-(0?[1-9]|[12]\d|30))|(((1[6-9]|[2-9]\d)\d{2})-0?2-(0?[1-9]|1\d|2[0-8]))|(((1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|((16|[2468][048]|[3579][26])00))-0?2-29-))(\s(([01]\d{1})|(2[0123])):([0-5]\d):([0-5]\d))?$/, '日期格式不正确']
				});

				
				$("#sub").click(function (){
				var inputs = $("input[name=dault_detail]");
				var id=$("input[class=orderId]").val();
					var json = [];

					for(var i = 0; i < inputs.length; i++) {
						var j = {};
						//						alert(inputs[i].value);// 等于 kk
						j.faultDetail = inputs[i].value;
						j.orderId = id;
						json.push(j);

					}
					console.log(json);
					var weixiu = JSON.stringify(json);
					console.log(weixiu);
					$.post("http://function.516code.cn/functionPage/function/updateMaintenancePlanstatu.do",{"json":weixiu}, function(res) {
                    //$.post("http://localhost:8999/function/updateMaintenancePlanstatu.do",{"json":weixiu}, function(res) {    
                        if(res==true){
                            layer.msg("上传成功！", {icon: 6, time: 1000, anim: 4}, function () {
                                parent.layer.close(parent.layer.getFrameIndex(window.name));
                            });
                        }else{

                            layer.msg("上传失败！", {icon: 6, time: 1000, anim: 4}, function () {
                                parent.layer.close(parent.layer.getFrameIndex(window.name));
                            });
                        }
						
						
					}, 'json');
				})
			})
			
		</script>
	</body>

</html>